--- /dev/null
+<interface>
+ <object class="GtkShortcutsWindow" id="help_overlay">
+ <child>
+ <object class="GtkShortcutsSection">
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="title">General</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="accelerator">F1</property>
+ <property name="title">Show About Dialog</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="accelerator"><Control>q</property>
+ <property name="title">Quit</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
{ "quit", activate_quit, NULL, NULL, NULL },
{ "inspector", activate_inspector, NULL, NULL, NULL },
};
+ struct {
+ const gchar *action_and_target;
+ const gchar *accelerators[2];
+ } accels[] = {
+ { "app.about", { "F1", NULL } },
+ { "app.quit", { "<Control>q", NULL } },
+ };
+ int i;
/* Most code in gtk-demo is intended to be exemplary, but not
* these few lines, which are just a hack so gtk-demo will work
app_entries, G_N_ELEMENTS (app_entries),
app);
+ for (i = 0; i < G_N_ELEMENTS (accels); i++)
+ gtk_application_set_accels_for_action (app, accels[i].action_and_target, accels[i].accelerators);
+
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0, G_OPTION_ARG_NONE, "Show program version", NULL);
g_application_add_main_option (G_APPLICATION (app), "run", 0, 0, G_OPTION_ARG_STRING, "Run an example", "EXAMPLE");
g_application_add_main_option (G_APPLICATION (app), "list", 0, 0, G_OPTION_ARG_NONE, "List examples", NULL);
<attribute name="label" translatable="yes">_Inspector</attribute>
<attribute name="action">app.inspector</attribute>
</item>
+ <item>
+ <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+ <attribute name="action">win.show-help-overlay</attribute>
+ </item>
<item>
<attribute name="label" translatable="yes">_About GTK Demo</attribute>
<attribute name="action">app.about</attribute>